package ideamaps.action;


import ideamaps.domain.Friend;
import ideamaps.domain.Request;
import ideamaps.domain.User;
import ideamaps.manager.FriendManager;
import ideamaps.manager.UserManager;

import com.taillive.commons.ConvertUtils;
import com.taillive.commons.TextUtils;
import com.taillive.core.dao.support.Page;
import com.taillive.core.web.StrutsAction;

public class UserHomeAction extends StrutsAction{
	

	private UserManager userManager;
	public void setUserManager(UserManager userManager) {
		this.userManager = userManager;
	}
	
	private FriendManager friendManager;

	public void setFriendManager(FriendManager friendManager) {
		this.friendManager = friendManager;
	}

	
	private String username;
	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}
	
	
	private User user;
	public User getUser() {
		return user;
	}

	public void setUser(User user) {
		this.user = user;
	}
	
	
	private Request req;
	public Request getReq() {
		return req;
	}

	public void setReq(Request req) {
		this.req = req;
	}

	public Friend f;
	
	public Friend getF() {
		return f;
	}

	public void setF(Friend f) {
		this.f = f;
	}

	public String user(){
		String sessionUsername = (String)getSession().getAttribute("sessionUsername");
		user = userManager.getByUsername(username);
		if(sessionUsername!=null) {
			req  = friendManager.getRequestByUsernameAndRequestUsername(username, sessionUsername);
		}	
		    f =friendManager.getFriendByUsernameAndFriendUsername(sessionUsername,username);
		return SUCCESS;
	}








}
